$.ajax({
    // 'url': '../电影json/movies.json',
    "url": "https://www.fastmock.site/mock/bb4157f45a0b5ffdcb3f6d984517a6c0/woniuMovie/getAllMovies",
    "success": function (data) {
        $.ajax({
            // 'url': '../电影json/types.json',
            "url": "https://www.fastmock.site/mock/bb4157f45a0b5ffdcb3f6d984517a6c0/woniuMovie/getAllTypes",
            "success": function (name) {
                // 整体数据
                var arr = data.movies;
                console.log(arr);

                // 标题和id
                var arr2 = name.types;
                console.log(arr2);


                //大框架
                for (var i = 0; i < 14; i++) {
                    var good = arr[i];
                    var title = arr2[i];

                    addBig(title, good);
                }
                //小内容
                for (let j = 0; j < arr.length; j++) {
                    var good = arr[j];
                    //种类
                    var goodFliter = good.movieType;
                    goodFliter.forEach(v => {
                        addMin(good, v);
                    });

                }
                $('#loading').hide();

            }
        });
    }
});




//大框架
function addBig(t, e) {
    $('.main').append(`
    <div class="item">
                <div class="head">
                    <span>${t.name}</span>
                    <a href="">查看更多</a>
                </div>
                <div class="item-content id${t.id}">

                </div>
            
        </div>
        
    `)
}
//小内容
function addMin(e, t) {

    $(`.id${t}`).append(`
    <a href="detail.html?id=${e.id}">
    <div>
        <img src="${e.imgSrc}" alt="">
        <p>${e.title}</p>
    </div>
</a>
    `)

}
